﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace MLRobotic.Tower.Messaging
{
    public class Messenger
    {
        public static Messenger Instance = new Messenger();

        public Action<COM, PacketType> WhoIsResponse { get; set; }
        public Action MatchStarted { get; set; }
        public Action<int> FindBeacons { get; set; }
        public Action<int, Point> ReceivedBeacons { get; set; }

        public void SendWhoIsResponse(COM com, PacketType packet)
        {
            if (WhoIsResponse != null)
                WhoIsResponse(com, packet);
        }

        public void SendMatchStarted()
        {
            if (MatchStarted != null)
                MatchStarted();
        }

        public void SendFindBeacons(int id)
        {
            if (FindBeacons != null)
                FindBeacons(id);
        }

        public void SendReceivedBeacons(int id, Point polar)
        {
            if (ReceivedBeacons != null)
                ReceivedBeacons(id, polar);
        }
    }
}
